package com.woniuxy.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.woniuxy.entity.BiddingRoom;
import com.woniuxy.entity.Product;
import com.woniuxy.entity.User;
import com.woniuxy.service.LovegoodsService;
import com.woniuxy.utils.LovegoodsInfo;
import com.woniuxy.utils.ResultUtil;

@Controller
@RequestMapping("/lovegoods")
public class LovegoodsController {
	
	@Autowired
	LovegoodsService lovegoodsService;
	
	
	@RequestMapping("/lovegoodsInfo")
	@ResponseBody
	public List<LovegoodsInfo> lovegoodsInfo(){
		//先获取到uid
		Subject currentUser = SecurityUtils.getSubject();
		Session session = currentUser.getSession();
		User user = (User)session.getAttribute("user");
		//调用service方法  查询数据库  
		List<LovegoodsInfo> products = new ArrayList();
		/*products = lovegoodsService.lovegoodsInfo(user); */
		products = lovegoodsService.lovegoodsInfo(user);
		
		System.out.println("dasdasd"+products);
		
		return products;
	} 

}
